package com.ge.energy.pgs.myfleet.code.user;

import java.io.IOException;

import org.eclipse.jetty.util.ajax.JSON;

import com.ge.energy.pgs.myfleet.code.factory.MyServletFactory;
import com.ge.energy.pgs.myfleet.code.vo.Contact;
import com.ge.energy.pgs.myfleet.database.data.DataInitBean;
import com.ge.energy.pgs.myfleet.database.table.UserTable;

public class BedoMenuIpml extends BedoBasicImpl{
	public void $service_fetch_friend(String id) throws IOException{
		Contact contact = null;
		for(UserTable user : DataInitBean.userTable){
			if(user.getUserId().equals(id)){
				contact = new Contact();
				contact.setContactDec(user.getUserDec());
				contact.setContactId(user.getUserId());
				contact.setContactImg(user.getUserImg());
				contact.setContactName(user.getUserName());
				contact.setContactSex(user.getUserSex());
				break;
			}
		}
		
		if(contact != null){
			MyServletFactory.getSockets().get(this.myInfo.getContactId()).getConn().sendMessage("{\"flag\":\"$client_fetch_friend\",\"status\":\"success\",\"backvalue\":"+ this.gson.toJson(contact) +"}");
		}else{
			MyServletFactory.getSockets().get(this.myInfo.getContactId()).getConn().sendMessage("{\"flag\":\"$client_fetch_friend\",\"status\":\"fail\",\"backvalue\":\"\"}");
		}
	}
	public void $service_add_friend(String idcategory){
		
	}
}
